feat(relay): add buzz-admin member management CLI with NIP-43 roster publish#1265
Merged
Conversation
…publish Relay membership management previously required raw SQL via `docker compose exec postgres psql`. This adds a first-class operator CLI via buzz-admin (the existing dedicated operator binary). buzz-admin add-member / remove-member / list-members: - Accept bech32 npub or 64-char hex via nostr::PublicKey::parse - Reject role 'owner' (use RELAY_OWNER_PUBKEY config instead) - After add/remove: publish kind:13534 membership roster via Redis so live clients see the updated list immediately - custom_created_at = max(now, newest_existing_13534 + 1s) defeats same-second domination for serial invocations - Exit codes: 0=success 1=validation 2=NotFound 3=IsOwner 4=RoleMismatch 5=DB/Redis error Dockerfile: build and ship buzz-admin alongside buzz-relay so `docker compose exec relay buzz-admin` works out of the box. deploy/compose/run.sh: add-member / remove-member / list-members shortcuts delegate to buzz-admin inside the container. NOSTR.md: document the CLI, NIP-43 admin events (kind:9030-9032), kind:13534 roster subscription, and known limitations. ARCHITECTURE.md: add remove-member to the buzz-admin subcommand table; note binary is now shipped in the relay image. Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
3024884 to
218a562
Compare
Co-authored-by: Will Pfleger <pfleger.will@gmail.com> Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Relay membership management previously required raw SQL via
docker compose exec postgres psql. This PR adds a first-class operator CLI viabuzz-admin— the existing dedicated operator binary — and ships it in the relay Docker image.Changes
crates/buzz-admin/src/main.rsUpgrades the stub
add-member/list-membersimplementations and addsremove-member:nostr::PublicKey::parseowner(useRELAY_OWNER_PUBKEYconfig to set the relay owner)custom_created_at = max(now, newest_existing_13534 + 1s)defeats same-second domination for serial invocationsDockerfileBuilds and ships
buzz-adminalongsidebuzz-relaysodocker compose exec relay buzz-adminworks out of the box.deploy/compose/run.shAdds
add-member,remove-member, andlist-membersshortcuts that delegate tobuzz-admininside the container.NOSTR.mdDocuments the CLI, NIP-43 admin events (kind:9030-9032), kind:13534 roster subscription, and known limitations (delta-omission, TOCTOU concurrency scope).
ARCHITECTURE.mdAdds
remove-memberto the buzz-admin subcommand table; notes that the binary is now shipped in the relay image.Usage
Known Limitations
publish_nip43_deltais in-process-only (no Redis hop); the kind:13534 list snapshot is the authoritative rosterrun.shserialization guards against parallel adds